﻿using Grow.ObjectMapper.CreateObjectMapper;
using Mapster;

namespace Grow.ObjectMapper.Mapster.CreateObjectMapper
{
    public class MapperBuilder<TSource, TResult> : IMapperBuilder<TSource, TResult>
    {
        private readonly TypeAdapterSetter<TSource, TResult> _typeAdapterSetter;

        public MapperBuilder(TypeAdapterSetter<TSource, TResult> typeAdapterSetter)
        {
            _typeAdapterSetter = typeAdapterSetter;
        }

        public IMapperBuilder<TSource, TResult> Map<TResultMember, TSourceMember>(System.Linq.Expressions.Expression<Func<TResult, TResultMember>> memberExpression, System.Linq.Expressions.Expression<Func<TSourceMember>> sourceExpression)
        {
            _ = _typeAdapterSetter.Map(memberExpression, sourceExpression);
            return this;
        }
    }
}
